#ifndef WORLD_H
#define WORLD_H

#include <utils/String.h>
#include <utils/Maths.h>
#include <core/IRenderer.h>
#include <concrete/Entity.h>

class World
{
	
	typedef std::vector<Entity*> EntityList;
	typedef std::vector<Entity*>::iterator EntityListIterator;
	typedef std::vector<VisibleEntity*> VisibleEntityList;
	typedef std::vector<VisibleEntity*>::iterator VisibleEntityListIterator;
	
	EntityList        m_pEntities;
	VisibleEntityList m_pVisibleEntities;
	
public:
	
	virtual void update()
	{
		EntityListIterator itEntity;
		for ( itEntity = m_pEntities.begin(); itEntity != m_pEntities.end(); ++itEntity ) {
			(*itEntity)->update();
		}
	}
	
	virtual void draw();
	
	virtual Entity* addEntity( const Entity& e )
	{
		Entity* pEntity = new Entity( e );
		m_pEntities.push_back( pEntity );
		return pEntity;
	}
	
	virtual VisibleEntity* addVisibleEntity( const VisibleEntity& e )
	{
		VisibleEntity* pEntity = new VisibleEntity( e );
		std::cout << "Added new VisibleEntity at address " << pEntity << std::endl;
		m_pVisibleEntities.push_back( pEntity );
		m_pEntities.push_back( pEntity );
		return pEntity;
	}
	
};

#endif
